package shuai7boy.vip.transformer.model.value.reduce;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableUtils;

import com.sun.jersey.core.impl.provider.header.WriterUtil;

import shuai7boy.vip.common.KpiTypeEnum;
import shuai7boy.vip.transformer.model.value.BaseStatsValueWritable;

public class MapWritableValue extends BaseStatsValueWritable {

	private MapWritable value=new MapWritable();
	private KpiTypeEnum kpi;
	
	public MapWritableValue() {
		super();
	}
	
	public MapWritableValue(MapWritable writable,KpiTypeEnum kpi) {
		this.value=writable;
		this.kpi=kpi;
	}
	
	public MapWritable getValue() {
		return value;
	}

	public void setValue(MapWritable value) {
		this.value = value;
	}

	public void setKpi(KpiTypeEnum kpi) {
		this.kpi = kpi;
	}

	
	
	@Override
	public void write(DataOutput out) throws IOException {
		// TODO Auto-generated method stub
		this.value.write(out);
		WritableUtils.writeEnum(out, kpi);
	}

	@Override
	public void readFields(DataInput in) throws IOException {
		// TODO Auto-generated method stub
		this.value.readFields(in);
		WritableUtils.readEnum(in, KpiTypeEnum.class);
	}

	@Override
	public KpiTypeEnum getKpi() {
		// TODO Auto-generated method stub
		return this.kpi;
	}

	
	
	
}
